<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var a = prompt('输出一个数字');
        var b = prompt('输出一个数字');
        for (var c = a; c >= 1; c++) {
            if (a % c == 0 && b % c == 0) {
                document.write('最大公约数是' + c)
                break;
            }
        }
        for (var i = a; i <= a * b; i++) {
            if (i % b == 0 && i % a == 0) {
                document.write('最小共倍数是'+i+ "<br>")
                break;
            }
        }
    </script>
   

</body>

</html>